package com.pan.admin.generator.constant;

import com.gitee.apanlh.util.base.Eq;

/**
 *  平台解析撞库字段
 *
 *  @author Pan
 */
public enum ApiGenPlatParseDataExchangeFieldEnum {

    DATA(                "data",             "响应体名称",       "String"),
    CODE(                "code",             "响应状态码",       "Integer"),
    MSG(                 "msg",              "响应消息",         "String"),
    PRICE(               "price",            "原价价格",         "BigDecimal"),
    LOGO(                "logo",             "返回logo",         "String"),
    COMPANY_NAME(        "companyName",      "返回公司名称",      "String"),
    PRODUCT_NAME(        "productName",      "返回产品名称",      "String"),
    CALL_URL(            "callUrl",          "半流程-回调页面",    "String"),
    APPLY_ID(            "applyId",          "半流程-进件流程ID",  "String"),
    PROTOCOL_LIST(       "protocolList",     "协议集合",          "List"),
    PROTOCOL_NAME(       "protocolName",     "协议名称",          "String"),
    PROTOCOL_NAME_URL(   "protocolUrl",  "协议地址",          "String"),
    LIST_PHONE_MD5(      "listPhoneMd5",     "手机号掩码MD5集合",  "List"),
    ;

    /** 字段名称 */
    private String fieldName;
    /** 字段名称中文名 */
    private String fieldChineseName;
    /** 字段类型 */
    private String javaType;

    ApiGenPlatParseDataExchangeFieldEnum(String fieldName, String fieldChineseName, String javaType) {
        this.fieldName = fieldName;
        this.fieldChineseName = fieldChineseName;
        this.javaType = javaType;
    }

    public String getFieldName() {
        return fieldName;
    }

    public String getFieldChineseName() {
        return fieldChineseName;
    }

    public String getJavaType() {
        return javaType;
    }

    public boolean hasEnum(ApiGenPlatParseDataExchangeFieldEnum apiGenPlatParseDataExchangeFieldEnum) {
        return Eq.enums(this, apiGenPlatParseDataExchangeFieldEnum);
    }

    public static ApiGenPlatParseDataExchangeFieldEnum getByFieldName(String fieldName) {
        ApiGenPlatParseDataExchangeFieldEnum[] values = ApiGenPlatParseDataExchangeFieldEnum.values();
        for (ApiGenPlatParseDataExchangeFieldEnum value : values) {
            if (Eq.str(value.getFieldName(), fieldName)) {
                return value;
            }
        }
        return null;
    }

    public static ApiGenPlatParseDataExchangeFieldEnum getByName(String enumName) {
        ApiGenPlatParseDataExchangeFieldEnum[] values = ApiGenPlatParseDataExchangeFieldEnum.values();
        for (ApiGenPlatParseDataExchangeFieldEnum value : values) {
            if (value.name().equals(enumName)) {
                return value;
            }
        }
        return null;
    }

}
